package demoHomework;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class DouDizhu {
	public static void main(String[] args) {
		ArrayList<String> poker=new ArrayList<String>();
		Map<Integer, String> map =new HashMap<Integer, String>();
		String[] colors={"♥","♣","♦","♠"}; 
		String[] numbers={"2","A","K","Q","J","10","9","8","7","6","5","4","3"};
		poker.add("大王");poker.add("小王");
		
		for(String number:numbers){
			for(String color:colors){
				poker.add(color+number);
			}
		}
		
		Collections.shuffle(poker);
		
		Player player1=new Player("laoli");
		Player player2=new Player("laowang");
		Player player3=new Player("laoliu");
		
		for(int i=0;i<poker.size();i++){
			
			String p = poker.get(i);
			if(i<=51){
				if(i%3==0){
					player1.getList().add(p);
				}else if(i%3==1){
					player2.getList().add(p);
				}else{
					player3.getList().add(p);
				}
			}
		}
		Collections.sort(player1.getList());
		Collections.sort(player2.getList());
		Collections.sort(player3.getList());
		ArrayList<String> list1 =new ArrayList<String>();
		ArrayList<String> list2 =new ArrayList<String>();
		ArrayList<String> list3 =new ArrayList<String>();
		player1.getList().forEach(t->list1.add(map.get(t)));
		player2.getList().forEach(t->list2.add(map.get(t)));
		player3.getList().forEach(t->list3.add(map.get(t)));
		System.out.println(player1.getName()+":"+player1.getList());
		System.out.println(player2.getName()+":"+player2.getList());
		System.out.println(player3.getName()+":"+player3.getList());
		
	}
}
